{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

<section class="failed-or-lost">
  <h4>Replaced Allocations</h4>
  <div class="failed-or-lost-links">
    {{#if @supportsRescheduling}}
      <span>
        <Hds::TooltipButton @text="Allocations that have been rescheduled, on another node if possible, due to failure or manual restart" aria-label="Info">
          <Hds::Icon @name="info" @isInline={{true}} />
        </Hds::TooltipButton>
        <ConditionalLinkTo
          @condition={{@rescheduledAllocs.length}}
          @route="jobs.job.allocations"
          @model={{@job}}
          @query={{hash scheduling='["has-been-rescheduled"]' version=(concat '[' @job.latestDeployment.versionNumber ']')}}
          @label="View Allocations"
        >
          {{@rescheduledAllocs.length}} Rescheduled
        </ConditionalLinkTo>
      </span>
    {{/if}}

    <span>
      <Hds::TooltipButton @text="Allocations that have been restarted in-place due to a task failure or manual restart" aria-label="Info">
        <Hds::Icon @name="info" @isInline={{true}} />
      </Hds::TooltipButton>
      <ConditionalLinkTo
        @condition={{@restartedAllocs.length}}
        @route="jobs.job.allocations"
        @model={{@job}}
        @query={{hash scheduling='["has-been-restarted"]' version=(concat '[' @job.latestDeployment.versionNumber ']')}}
        @label="View Allocations"
      >
        {{@restartedAllocs.length}} Restarted
      </ConditionalLinkTo>
    </span>
  </div>
</section>